// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: donggu
#pragma once
#include <experimental/filesystem>

#include <nlohmann/json.hpp>
#include <toml.hpp>

// these serialization / deserialization methods throw on failure.

namespace coin2::base {

nlohmann::json path_to_json(const std::experimental::filesystem::path& path);
nlohmann::json toml_to_json(const toml::value& doc);
template <typename TProto>
nlohmann::json proto_to_json(const TProto& doc);

toml::value path_to_toml(const std::experimental::filesystem::path& path);
toml::value json_to_toml(const nlohmann::json& doc);
template <typename TProto>
toml::value proto_to_toml(const TProto& doc);

template <typename TProto>
TProto path_to_proto(const std::experimental::filesystem::path& path);
template <typename TProto>
TProto json_to_proto(const nlohmann::json& doc);
template <typename TProto>
TProto toml_to_proto(const toml::value& doc);

}  // namespace coin2::base
